# 作者：陈睿-cruise
# 2025年02月19日18时39分56秒
# 2979386061@qq.com
import re
#findall匹配到所有，直接返回列表形式
text = "My numbers are 123 and 456."
matches = re.findall(r'\d+', text)
print(matches)  # 输出: ['123', '456']
#search匹配到第一个
text = "My number is 123."
match = re.search(r'\d+', text)
if match:
    print("Found:", match.group())  # 输出: Found: 123
#match匹配到开头
text = "123 is my number."
match = re.match(r'\d+', text)
if match:
    print("Match found:", match.group())  # 输出: Match found: 123

text2 = "My number is 123."
match2 = re.match(r'\d+', text2)
if not match2:
    print("No match at the start.")  # 输出: No match at the start.